
var convertExcel = require('excel-as-json').processFile;

module.exports = {
  excel2json: function (inpath, outpath) {
    var options = {
      sheet:'1',
      isColOriented: false,
      omitEmtpyFields: false
    };
    return new Promise((resolve, reject) => {
      convertExcel(inpath, outpath, options, (err, data) => {
        if (err) {
          console.log("JSON conversion failure: #{err}");
          reject(err);
        }
        resolve(data);
      });
    })
  },
  resbody: function (req) {
    return {
      status: 200,
      user: req.session.username,
      msg: null,
      time: new Date().Format("yyyy-MM-dd hh:mm:ss")
    }
  }
};
